<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2018/9/10
 * Time: 14:35
 */

namespace app\index\model;


class Order extends Base
{
    protected $table = 'sy_order';

    public function getSnapItemsAttr($value)
    {
        return json_decode($value, true);
    }

    public function getSnmpAddressAttr($value)
    {
        return json_decode($value, true);
    }

    public function getSnapAddressAttr($value)
    {
        return json_decode($value, true);
    }

    public function user()
    {
        return $this->belongsTo('User', 'user_id', 'id');
    }

    public function product()
    {
        return $this->hasMany('OrderProduct', 'order_id', 'id');
    }
}